package com.ssy.lingxi.purchase.service;

import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.request.ImportBatchListRequest;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.purchase.api.dto.request.*;
import com.ssy.lingxi.purchase.api.dto.request.bidding.PurchaseMakeList;
import com.ssy.lingxi.purchase.api.dto.request.purchase.*;
import com.ssy.lingxi.purchase.api.dto.response.BiddingExternalWorkStateEnumResponse;
import com.ssy.lingxi.purchase.api.dto.response.bidding.PurchaseMakeListRequest;
import com.ssy.lingxi.purchase.api.dto.response.purchase.*;
import com.ssy.lingxi.purchase.entity.ImportBatchNo;
import com.ssy.lingxi.purchase.entity.purchaseinquiry.ExternalPurchaseInquiryLog;
import com.ssy.lingxi.purchase.entity.purchaseinquiry.InteriorPurchaseInquiryLog;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 采购询价单业务处理类
 *
 * @author wrc
 * @date 2021/1/19
 */
public interface PurchaseInquiryService {

    /**
     * 采购需求单列表查询
     */
    Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryList(UserLoginCacheDTO sysUser, PurchaseInquiryListRequest request);

    /**
     * 采购需求单详情查询
     */
    Wrapper<PurchaseInquiryDetailsResponse> purchaseInquiryDetails(BaseDetailsRequest request, UserLoginCacheDTO sysUser);

    Wrapper<PurchaseInquiryDetailsResponse> details(BaseDetailsRequest request, UserLoginCacheDTO sysUser);
    /**
     * 添加采购询价单
     */
    Wrapper purchaseInquiryAdd(PurchaseInquiryAddRequest request, UserLoginCacheDTO sysUser);


    /**
     * 修改需求单
     */
    Wrapper purchaseInquiryUpdate(PurchaseInquiryUpdateRequest request, UserLoginCacheDTO sysUser);


    /**
     * 删除需求单
     */
    Wrapper purchaseInquiryDelete(BaseRequest request, UserLoginCacheDTO sysUser);

    /**
     * 批量删除需求单
     */
    Wrapper purchaseInquiryDeleteBatch(BaseAllRequest request, UserLoginCacheDTO sysUser);


    /**
     * 待新增采购需求单
     */
    Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryAddList(PurchaseInquiryListRequest request, UserLoginCacheDTO sysUser);

    /**
     * 提交审核采购需求单
     */
    Wrapper purchaseInquiryExamine(BaseRequest request, UserLoginCacheDTO sysUser);


    /**
     * 提交审核采购需求单批量
     */
    Wrapper purchaseInquiryExamineBatch(BaseAllRequest request, UserLoginCacheDTO sysUser);

    /**
     * 采购询价-待审核采购需求单(一级)
     */
    Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryStayExamineList1(PurchaseInquiryListRequest request, UserLoginCacheDTO sysUser);


    /**
     * 采购询价-审核采购需求单(一级)
     */
    Wrapper purchaseInquiryExamine1(BaseExamineRequest request, UserLoginCacheDTO sysUser);


    /**
     * 审核采购需求单(一级)批量
     */
    Wrapper purchaseInquiryExamine1Batch(BaseAllRequest request, UserLoginCacheDTO sysUser);


    /**
     * 采购询价-待审核采购需求单(二级)
     */
    Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryStayExamineList2(PurchaseInquiryListRequest request, UserLoginCacheDTO sysUser);


    /**
     * 采购询价-审核采购需求单(二级)
     */
    Wrapper purchaseInquiryExamine2(BaseExamineRequest request, UserLoginCacheDTO sysUser);


    /**
     * 审核采购需求单(二级)批量
     */
    Wrapper purchaseInquiryExamine2Batch(BaseAllRequest request, UserLoginCacheDTO sysUser);


    /**
     * 待提交采购需求单
     */
    Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryStayCommitList(PurchaseInquiryListRequest request, UserLoginCacheDTO sysUser);

    /**
     * 提交采购需求单
     */
    Wrapper purchaseInquiryCommit(BaseExamineRequest request, UserLoginCacheDTO sysUser);


    /**
     * 采购询价-提交采购需求单批量
     */
    Wrapper purchaseInquiryCommitBatch(BaseAllRequest request, UserLoginCacheDTO sysUser);

    /**
     * 采购询价-需求对接-系统匹配会员信息列表
     */
    Wrapper<PageData<DemandMemberResponse>> systemMatchingMemberKInitializeList(MatchingMemberKInitializeListRequest request, UserLoginCacheDTO sysUser);


    /**
     * 采购询价-需求对接-系统匹配会员信息列表查询
     */
    Wrapper<PageData<DemandMemberResponse>> systemMatchingMemberList(BaseDetailsRequest request, UserLoginCacheDTO sysUser);

    /**
     * 采购询价-采购物料-分页查询
     */
    Wrapper<PageData<PurchaseInquiryProductRequest>> purchaseInquiryProductlist(BaseDetailsRequest request, UserLoginCacheDTO sysUser);

    /**
     * 查询导入批次号列表
     */
    Wrapper<List<ImportBatchNo>> importBatchList(ImportBatchListRequest request);

    /**
     * 采购需求单导入
     */
    Wrapper<List<PurchaseInquiryExcelRequest>> importExcel(MultipartFile file);


    /**
     * 采购需求单导入检查
     */
    Wrapper<String> importExcelCheck(MultipartFile file);


    /**
     * 批量执行报价截止时间到期的需求单外部流程-内部接口
     */
    void examineQuotedPriceBatch(ExamineQuotedPriceBatchRequest request);


    /**
     * 作废需求单
     */
    Wrapper purchaseInquiryCancel(PurchaseInquiryCancelRequest request, UserLoginCacheDTO sysUser);


    /**
     * 需求单详情-获取已经报价的物料详情列表分页查询
     */
    Wrapper<PageData<QuotedPriceProductResponse>> getMaterielsByPurchaseInquiryId(MaterielsByPurchaseInquiryIdRequest request, UserLoginCacheDTO sysUser);


    /**
     * 采购商机筛选-采购询价列表-需求对接为发布至平台且发布的商城为企业商城且商城环境为WEB的采购需求单
     */
    Wrapper<PageData<PurchaseListResponse>> platformPurchaseList(PurchaseListRequest request);


    /**
     * 采购公示
     */
    Wrapper<PageData<PurchaseMakeList>> purchaseMakeList(PurchaseMakeListRequest request);

    /**
     * 采购询价：
     * <p>
     * 1、取采购能力--采购询价模块中当
     * 前采购会员的采购需求单
     * 且外部状态为平台审核通过
     * 且需求对接为发布至平台
     * 且发布的商城为企业商城
     * 且商城环境为WEB的采购需求单，
     * 显示需求单摘要、交付日期、交付地址、发布时间、报价剩余时间、已有报价数（统计当前需求单已收到的报价数），按发布时间倒序显示UI设计时允许显示的采购询价单，展开显示采购物料，显示物料编号、物料名称、规格型号、品类、品牌、采购数量，最多显示条数根据UI设定，可收缩不显示采购物料
     */
    Wrapper<PageData<SearchReSourceListResponse>>  searchReSourceList(PurchaseShopListRequest request, UserLoginCacheDTO user, Long shopId);


    /**
     * 获取采购需求单内部流程状态
     */
    Wrapper<List<BiddingExternalWorkStateEnumResponse>> interiorStatus();


    /**
     * 获取采购需求单外部流程状态
     */
    Wrapper<List<BiddingExternalWorkStateEnumResponse>> externalStatus();

    /**
     *商城能力--企业直采--采购门户--询价单详情-接口
     */
    Wrapper<PurchaseInquiryDetailsResponse> searchReSourceDetails(BaseDetailsRequest request, UserLoginCacheDTO user);

    Page<InteriorPurchaseInquiryLog> getInquiryInteriorRecordList(PageVO pageVO, Long purchaseInquiryId, Long startTime, Long endTime);

    Page<ExternalPurchaseInquiryLog> getInquiryExternalRecordList(PageVO pageVO, Long purchaseInquiryId, Long startTime, Long endTime);


    /**
     * 待新增商城采购需求单
     * @param request 分页查询参数
     * @param sysUser 登录用户
     * @return 待新增商城采购需求单分页列表
     */
    Wrapper<PageData<PurchaseInquiryListResponse>> purchaseShopInquiryAddList(PurchaseInquiryListRequest request, UserLoginCacheDTO sysUser);
}
